package com.hzw.saas.api.msg.enums;

/**
 * <p>
 * 消息类型
 * </p>
 *
 * @author sonam
 * @since 2020/12/26 16:36
 */
public enum MsgType {

    SYSTEM_MSG(1,"系统消息"),
    GROUP_MSG(2,"群组消息"),
    USER_MSG(3,"个人消息");
    /**
     * 状态代号
     */
    private final int code;

    /**
     * 状态文本
     */
    private final String text;

    MsgType(int code, String text) {
        this.code = code;
        this.text = text;
    }

    public int code() {
        return code;
    }

    public String text() {
        return text;
    }

    public static MsgType instance(int code) {
        for (MsgType value : values()) {
            if (value.code() == code) {
                return value;
            }
        }
        return null;
    }
}

